<template>
  <div class="may-like">
    <h3>猜你喜欢</h3>
    <div class="card-container">
      <div class="card" v-for="(item, index) in cards" :key="index">
        <div class="card-header">
          <span class="region">{{ item.region }}</span>
          <span class="rating">{{ item.rating }}</span>
        </div>
        <img v-if="item.url" :src="item.url" :alt="item.title" class="card-image">
        <div class="card-body">
          <h4 class="title">{{ item.title }}</h4>
          <p class="desc">{{ item.desc }}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'

const cards = ref([
  {
    region: "",
    rating: "9.8",
    title: "名侦探柯南（中配）",
    desc: "小公主的侦探生活",
    url: "https://i0.hdslb.com/bfs/bangumi/image/38e2a273f528fd01c34f1fc4df0f69c64487efad.png@560w_746h_!web-ogv-anime-ranking-card.avif"
  },
  {
    region: "",
    rating: "9.9",
    title: "银魂",
    desc: "属于画头的热血动画",
    url: "https://i0.hdslb.com/bfs/bangumi/image/38e2a273f528fd01c34f1fc4df0f69c64487efad.png@560w_746h_!web-ogv-anime-ranking-card.avif"
  },
  {
    region: "",
    rating: "9.9",
    title: "未日后酒店",
    desc: "让A面献你的心",
    url: "https://i0.hdslb.com/bfs/bangumi/image/38e2a273f528fd01c34f1fc4df0f69c64487efad.png@560w_746h_!web-ogv-anime-ranking-card.avif"
  },
  {
    region: "",
    rating: "9.7",
    title: "摇滚乃是淑女的爱好",
    desc: "摇滚是淑女的好友",
    url: "https://i0.hdslb.com/bfs/bangumi/image/38e2a273f528fd01c34f1fc4df0f69c64487efad.png@560w_746h_!web-ogv-anime-ranking-card.avif"
  },
    {
    region: "",
    rating: "9.9",
    title: "未日后酒店",
    desc: "让A面献你的心",
    url: "https://i0.hdslb.com/bfs/bangumi/image/38e2a273f528fd01c34f1fc4df0f69c64487efad.png@560w_746h_!web-ogv-anime-ranking-card.avif"
  },
  {
    region: "",
    rating: "9.8",
    title: "摇滚乃是淑女的爱好",
    desc: "摇滚是淑女的好友",
    url: "https://i0.hdslb.com/bfs/bangumi/image/38e2a273f528fd01c34f1fc4df0f69c64487efad.png@560w_746h_!web-ogv-anime-ranking-card.avif"
  },
  {
    region: "",
    rating: "9.8",
    title: "名侦探柯南（中配）",
    desc: "小公主的侦探生活",
    url: "https://i0.hdslb.com/bfs/bangumi/image/38e2a273f528fd01c34f1fc4df0f69c64487efad.png@560w_746h_!web-ogv-anime-ranking-card.avif"
  },
  {
    region: "",
    rating: "9.9",
    title: "银魂",
    desc: "属于画头的热血动画",
    url: "https://i0.hdslb.com/bfs/bangumi/image/38e2a273f528fd01c34f1fc4df0f69c64487efad.png@560w_746h_!web-ogv-anime-ranking-card.avif"
  },
  {
    region: "",
    rating: "9.9",
    title: "未日后酒店",
    desc: "让A面献你的心",
    url: "https://i0.hdslb.com/bfs/bangumi/image/38e2a273f528fd01c34f1fc4df0f69c64487efad.png@560w_746h_!web-ogv-anime-ranking-card.avif"
  },
  {
    region: "",
    rating: "9.7",
    title: "摇滚乃是淑女的爱好",
    desc: "摇滚是淑女的好友",
    url: "https://i0.hdslb.com/bfs/bangumi/image/38e2a273f528fd01c34f1fc4df0f69c64487efad.png@560w_746h_!web-ogv-anime-ranking-card.avif"
  },
    {
    region: "",
    rating: "9.9",
    title: "未日后酒店",
    desc: "让A面献你的心",
    url: "https://i0.hdslb.com/bfs/bangumi/image/38e2a273f528fd01c34f1fc4df0f69c64487efad.png@560w_746h_!web-ogv-anime-ranking-card.avif"
  },
  {
    region: "",
    rating: "9.8",
    title: "摇滚乃是淑女的爱好",
    desc: "摇滚是淑女的好友",
    url: "https://i0.hdslb.com/bfs/bangumi/image/38e2a273f528fd01c34f1fc4df0f69c64487efad.png@560w_746h_!web-ogv-anime-ranking-card.avif"
  },
])
</script>

<style scoped lang="scss">
.may-like {
  width: 100%;
  margin: 0 auto;
  padding: 20px;

  h3 {
    font-size: 24px;
    margin-bottom: 20px;
    padding-left: 10px;
  }

  .card-container {
    display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); // 调整最小宽度
    gap: 16px;

    .card {
      background: #fff;
      border-radius: 8px;
      padding: 12px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      transition: all 0.3s ease;

      &:hover {
        transform: translateY(-5px);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
      }

      .card-header {
        display: flex;
        justify-content: space-between;
        margin-bottom: 8px;

        .region {
          color: #ff4d4f;
          font-size: 12px;
          font-weight: bold;
        }

        .rating {
          color: #ff9500;
          font-size: 12px;
          font-weight: bold;
        }
      }

      .card-image {
        width: 100%;
        height: auto;
        border-radius: 4px;
        margin-bottom: 12px;
        display: block;
      }

      .card-body {
        .title {
          font-size: 16px;
          margin: 0 0 8px 0;
          color: #333;
          font-weight: 600;
        }

        .desc {
          font-size: 14px;
          color: #666;
          margin: 0 0 8px 0;
        }
      }
    }
  }
}
</style>
